package com.wc.AlgoOJ_homework.AlgoOJ_HomeWork1.H_既约分数;

import java.util.Scanner;

/**
 * @Author congge
 * @Date 2024/1/20 14:19
 * @description http://43.138.190.70:8888/p/LQ1132T
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        int N = 2010;
        int[] sum = new int[N];
        sum[1] = 1;
        for (int i = 2; i < N; i++) {
            for (int j = 1; j < i; j++) {
                if (gcd(i, j) == 1) {
                    sum[i] += 2;
                }
            }
            sum[i] += sum[i - 1];
        }
        while (t-- > 0) {
            int n = sc.nextInt();
            System.out.println(sum[n]);
        }
    }

    static int gcd(int a, int b) {
        if (a > b) {
            return gcd(b, a);
        }

        while (b % a > 0) {
            int tmp = b % a;
            b = a;
            a = tmp;
        }
        return a;
    }
}
